<template>
  <el-dialog :visible.sync="dialogVisible"
             title="Reset Password">
    <el-form>
      <el-form-item label="Old password"
                    label-width="100">
        <el-input placeholder="请输入旧密码"
                  auto-complete="off"
                  @change="onChange"
                  v-model="form.oldpwd"
                  type="password" icon="check"></el-input>
      </el-form-item>
      <el-form-item label="New Password">
        <el-input placeholder="请输入新密码"
                  auto-complete="off"
                  v-model="form.pwd1"
                  type="password"></el-input>
      </el-form-item>
      <el-form-item label="Confirm New Password">
        <el-input placeholder="请再次输入新密码"
                  auto-complete="off"
                  v-model="form.pwd2"
                  type="password"></el-input>
      </el-form-item>
    </el-form>
    <span slot="footer"
          class="dialog-footer">
      <el-button @click="dialogVisible = false">Cancel</el-button>
      <el-button type="primary"
                 @click="onDialogConfirm">OK</el-button>
    </span>
  
  </el-dialog>
</template>

<script>
  export default {
    data () {
      return {
        dialogVisible: false,
        form: {
          account: '',
          oldpwd: '',
          pwd1: '',
          pwd2: ''
        }
      }
    },
    methods: {
      onDialogConfirm () {
        // update password 
        this.dialogVisible = false
      },
      onChange () {
        // check old pwd
      }
    },
    mounted () {
      this.form.oldpwd = ''
      this.form.pwd1 = ''
      this.form.pwd2 = ''
    }
  }
</script>